package com.wty.common;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author wangtengyu
 * @Create 2018-08-30-19:07
 */
@Slf4j

public class DataSourceContextHolder {

    private static final ThreadLocal<String> contextholder=new ThreadLocal<>();



    public static  void setDB(String dbName){
        log.info("切换到{}数据库",dbName);
        contextholder.set(dbName);
    }

    public static String getDB(){
        return contextholder.get();
    }

    public static void clearDB(){
        contextholder.remove();
    }
}
